package com.lingnan.blog.service;

import com.lingnan.blog.entity.Friend;
import com.lingnan.blog.mapper.FriendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author HeGuanChao
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class FriendService {
    @Autowired
    private FriendMapper friendMapper;

    public int saveSelective(Friend friend) {
        return friendMapper.insertSelective(friend);
    }

    public Integer findCountByUid(Integer uid){
        return friendMapper.countByUid(uid);
    }

    public Integer findCountByFid(Integer fid){
        return friendMapper.countByFid(fid);
    }

    public Friend findByUIdAndFId(Integer uid, Integer fid) {
        return friendMapper.selectByUIdAndFId(uid,fid);
    }
}
